Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dynamic cache timeouts from flask responses #296

Merged
merged 4 commits into from
Apr 30, 2022

Conversation

phil-lopreiato
Copy link
Contributor

This diff adds custom Response type inheriting from flask.Response but adds a timeout property. The cached decorator will check if the response type is CachedResponse and if so, and if the timeout is nonnull, that value will take precedence over the static value stored on the decorated function.

This allows the timeout to be determined dynamically within the view, for example, based on the input args.

Closes #295

@northernSage
Copy link
Member

Thanks for the contribution @phil-lopreiato, could you please add an entry to CHANGES.rst describing the new feature?

@northernSage northernSage merged commit dc39067 into pallets-eco:master Apr 30, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 15, 2022
@phil-lopreiato phil-lopreiato deleted the dynamic-timeouts branch September 11, 2022 16:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

Support Dynamic Cache Timeouts Based on Response
2 participants